import 'package:flutter_shop/jpush/jpush_service.dart';
import 'package:flutter_shop/pages/base/base_presenter.dart';
import 'package:flutter_shop/pages/common/common_router.dart';
import 'package:flutter_shop/pages/common/login/entity/base_info.dart';
import 'package:flutter_shop/pages/member/member_router.dart';
import 'package:flutter_shop/pages/member/member_tab_page/member_tab_contract.dart';
import 'package:flutter_shop/pages/member/member_tab_page/member_tab_model.dart';
import 'package:flutter_shop/routers/navigator_utils.dart';
import 'package:flutter_shop/utils/utils.dart';
import 'package:flutter_shop/widget/custom_dialog.dart';

/// Title:MemberTabPresenter <br/>
/// Description: <br/>
/// author:xiemiao <br/>
/// date: 2020-03-11  <br/>
/// version 1.0 <br/>
class MemberTabPresenter extends BasePresenter<MemberTabView> {
  MemberTabModel mModel = MemberTabModel();

  ///去登录
  void goLogin() {
    NavigatorUtils.push(mContext, CommonRouter.loginPage);
  }

  ///退出登录
  void exitLogin() {
    Utils.showCustomDialog(
        mContext,
        ConfirmDialog(
          "真的退出登录吗?",
          confirmCallback: () {
            BaseInfo.clearUserInfo(mContext);
            //删除推送别名
            JpushService().deleteAlias();
          },
        ));
  }

  ///去个人信息
  void goPersonInfo() {
    NavigatorUtils.push(mContext, MemberRouter.personInfo);
  }
}
